home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / TextServices.p < prev    next >
Encoding:
Text File  |  1998-02-12  |  12.5 KB  |  341 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        TextServices.p
  3.  
  4.      Contains:    Text Services Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1991-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT TextServices;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __TEXTSERVICES__}
  28. {$SETC __TEXTSERVICES__ := 1}
  29.  
  30. {$I+}
  31. {$SETC TextServicesIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __MACTYPES__}
  38. {$I MacTypes.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __EVENTS__}
  41. {$I Events.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __MENUS__}
  44. {$I Menus.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __AEDATAMODEL__}
  47. {$I AEDataModel.p}
  48. {$ENDC}
  49. {$IFC UNDEFINED __AEREGISTRY__}
  50. {$I AERegistry.p}
  51. {$ENDC}
  52. {$IFC UNDEFINED __COMPONENTS__}
  53. {$I Components.p}
  54. {$ENDC}
  55.  
  56.  
  57. {$PUSH}
  58. {$ALIGN MAC68K}
  59. {$LibExport+}
  60.  
  61.  
  62. CONST
  63.     kTextService                = 'tsvc';                        {  component type for the component description  }
  64.     kInputMethodService            = 'inpm';                        {  component subtype for the component description  }
  65.     kTSMVersion                    = $0200;                        {  Version of the Text Services Manager is 2.0   }
  66.     kTextServiceVersion2        = 'tsv2';                        {  Interface type for V2 interfaces  }
  67.  
  68. {  Language and Script constants }
  69.     kUnknownLanguage            = $FFFF;
  70.     kUnknownScript                = $FFFF;
  71.     kNeutralScript                = $0000FFFF;
  72.  
  73.  
  74. {  Standard collection tags }
  75.  
  76.     kInteractiveServicesTag        = 'tmin';
  77.     kLocaleIDTag                = 'loce';
  78.     kTextInputObjectTag            = 'tiot';
  79.     kLocaleObjectRefTag            = 'lobj';
  80.     kLocaleRefTag                = 'lref';
  81.     kKeyboardInputMethodContextTag = 'kinp';
  82.     kKeyboardLocaleObjectRefTag    = 'kilo';
  83.     kHandwritingInputMethodContextTag = 'hinp';
  84.     kHandwritingLocaleObjectRefTag = 'hilo';
  85.     kSpeechInputMethodContextTag = 'sinp';
  86.     kSpeechLocaleObjectRefTag    = 'silo';
  87.     kPasswordModeTag            = 'pwdm';
  88.     kRefconTag                    = 'refc';
  89.     kUseFloatingWindowTag        = 'uswm';
  90.     kReadOnlyDocumentTag        = 'isro';
  91.     kSupportsMultiInlineHolesTag = 'minl';
  92.     kProtocolVersionTag            = 'nprt';
  93.     kTSMContextCollectionTag    = 'tsmx';
  94.  
  95. {  Standard tags for input method modes }
  96.  
  97.     kIMRomanInputMode            = 'romn';
  98.     kIMPasswordInputMode        = 'pasw';
  99.     kIMXingInputMode            = 'xing';
  100.     kIMHuaInputMode                = 'huam';
  101.     kIMPinyinInputMode            = 'piny';
  102.     kIMQuweiInputMode            = 'quwe';
  103.     kIMCangjieInputMode            = 'cgji';
  104.     kIMJianyiInputMode            = 'jnyi';
  105.     kIMZhuyinInputMode            = 'zhuy';
  106.     kIMB5CodeInputMode            = 'b5cd';
  107.     kIMKatakanaInputMode        = 'kata';
  108.     kIMHiraganaInputMode        = 'hira';
  109.  
  110. {  Variant tags for the input modes }
  111.  
  112.     kIM2ByteInputMode            = '2byt';
  113.     kIM1ByteInputMode            = '1byt';
  114.     kIMDirectInputMode            = 'dinp';
  115.  
  116.  
  117. {  Text Services LocaleObject Attributes }
  118.  
  119.     kNeedsInputWindow            = 1;
  120.     kHandlesUpdateRegion        = 2;
  121.     kHandlesGetRegion            = 3;
  122.     kHandlesPos2Offset            = 4;
  123.     kHandlesOffset2Pos            = 5;
  124.     kInPasswordMode                = 6;
  125.     kHandleMultipleHoles        = 7;
  126.     kDocumentIsReadOnly            = 8;
  127.  
  128.  
  129.                                                                 {  Component Flags in ComponentDescription  }
  130.     bTakeActiveEvent            = 15;                            {  bit set if the component takes active event  }
  131.     bHandleAERecording            = 16;                            {  bit set if the component takes care of recording Apple Events <new in vers2.0>  }
  132.     bScriptMask                    = $00007F00;                    {  bit 8 - 14  }
  133.     bLanguageMask                = $000000FF;                    {  bit 0 - 7   }
  134.     bScriptLanguageMask            = $00007FFF;                    {  bit 0 - 14   }
  135.  
  136.                                                                 {  Low level routines which are dispatched directly to the Component Manager  }
  137.     kCMGetScriptLangSupport        = $0001;                        {  Component Manager call selector 1  }
  138.     kCMInitiateTextService        = $0002;                        {  Component Manager call selector 2  }
  139.     kCMTerminateTextService        = $0003;                        {  Component Manager call selector 3  }
  140.     kCMActivateTextService        = $0004;                        {  Component Manager call selector 4  }
  141.     kCMDeactivateTextService    = $0005;                        {  Component Manager call selector 5  }
  142.     kCMTextServiceEvent            = $0006;                        {  Component Manager call selector 6  }
  143.     kCMGetTextServiceMenu        = $0007;                        {  Component Manager call selector 7  }
  144.     kCMTextServiceMenuSelect    = $0008;                        {  Component Manager call selector 8  }
  145.     kCMFixTextService            = $0009;                        {  Component Manager call selector 9  }
  146.     kCMSetTextServiceCursor        = $000A;                        {  Component Manager call selector 10  }
  147.     kCMHidePaletteWindows        = $000B;                        {  Component Manager call selector 11  }
  148.  
  149.  
  150.  
  151.  
  152.  
  153. {  New opaque definitions for types }
  154.  
  155. TYPE
  156.     TSMDocumentID = ^LONGINT;
  157.     InterfaceTypeList                    = ARRAY [0..0] OF OSType;
  158.  
  159. { Text Service Info List }
  160.     TextServiceInfoPtr = ^TextServiceInfo;
  161.     TextServiceInfo = RECORD
  162.         fComponent:                Component;
  163.         fItemName:                Str255;
  164.     END;
  165.  
  166.     TextServiceListPtr = ^TextServiceList;
  167.     TextServiceList = RECORD
  168.         fTextServiceCount:        INTEGER;                                {  number of entries in the 'fServices' array  }
  169.         fServices:                ARRAY [0..0] OF TextServiceInfo;        {  Note: array of 'TextServiceInfo' records follows  }
  170.     END;
  171.  
  172.     TextServiceListHandle                = ^TextServiceListPtr;
  173.     ScriptLanguageRecordPtr = ^ScriptLanguageRecord;
  174.     ScriptLanguageRecord = RECORD
  175.         fScript:                ScriptCode;
  176.         fLanguage:                LangCode;
  177.     END;
  178.  
  179.     ScriptLanguageSupportPtr = ^ScriptLanguageSupport;
  180.     ScriptLanguageSupport = RECORD
  181.         fScriptLanguageCount:    INTEGER;                                {  number of entries in the 'fScriptLanguageArray' array  }
  182.         fScriptLanguageArray:    ARRAY [0..0] OF ScriptLanguageRecord;    {  Note: array of 'ScriptLanguageRecord' records follows  }
  183.     END;
  184.  
  185.     ScriptLanguageSupportHandle            = ^ScriptLanguageSupportPtr;
  186. { High level TSM Doucment routines }
  187. FUNCTION NewTSMDocument(numOfInterface: INTEGER; VAR supportedInterfaceTypes: InterfaceTypeList; VAR idocID: TSMDocumentID; refcon: LONGINT): OSErr;
  188.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  189.     INLINE $7000, $AA54;
  190.     {$ENDC}
  191. FUNCTION DeleteTSMDocument(idocID: TSMDocumentID): OSErr;
  192.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  193.     INLINE $7001, $AA54;
  194.     {$ENDC}
  195. FUNCTION ActivateTSMDocument(idocID: TSMDocumentID): OSErr;
  196.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  197.     INLINE $7002, $AA54;
  198.     {$ENDC}
  199. FUNCTION DeactivateTSMDocument(idocID: TSMDocumentID): OSErr;
  200.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  201.     INLINE $7003, $AA54;
  202.     {$ENDC}
  203. FUNCTION SetTSMCursor(mousePos: Point): BOOLEAN;
  204.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  205.     INLINE $7006, $AA54;
  206.     {$ENDC}
  207. FUNCTION FixTSMDocument(idocID: TSMDocumentID): OSErr;
  208.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  209.     INLINE $7007, $AA54;
  210.     {$ENDC}
  211. { Utilities }
  212. FUNCTION UseInputWindow(idocID: TSMDocumentID; useWindow: BOOLEAN): OSErr;
  213.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  214.     INLINE $7010, $AA54;
  215.     {$ENDC}
  216. FUNCTION TSMEvent(VAR event: EventRecord): BOOLEAN;
  217.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  218.     INLINE $7004, $AA54;
  219.     {$ENDC}
  220. FUNCTION TSMMenuSelect(menuResult: LONGINT): BOOLEAN;
  221.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  222.     INLINE $7005, $AA54;
  223.     {$ENDC}
  224. FUNCTION InitTSMAwareApplication: OSErr;
  225.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  226.     INLINE $7014, $AA54;
  227.     {$ENDC}
  228. FUNCTION CloseTSMAwareApplication: OSErr;
  229.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  230.     INLINE $7015, $AA54;
  231.     {$ENDC}
  232. { Redundant Utilities }
  233. FUNCTION SendAEFromTSMComponent({CONST}VAR theAppleEvent: AppleEvent; VAR reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: LONGINT; idleProc: AEIdleUPP; filterProc: AEFilterUPP): OSErr;
  234.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  235.     INLINE $700B, $AA54;
  236.     {$ENDC}
  237. FUNCTION NewServiceWindow(wStorage: UNIV Ptr; {CONST}VAR boundsRect: Rect; title: Str255; visible: BOOLEAN; theProc: INTEGER; behind: WindowPtr; goAwayFlag: BOOLEAN; ts: ComponentInstance; VAR window: WindowPtr): OSErr;
  238.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  239.     INLINE $7011, $AA54;
  240.     {$ENDC}
  241. FUNCTION NewCServiceWindow(wStorage: UNIV Ptr; {CONST}VAR boundsRect: Rect; title: Str255; visible: BOOLEAN; theProc: INTEGER; behind: WindowPtr; goAwayFlag: BOOLEAN; ts: ComponentInstance; VAR window: WindowPtr): OSErr;
  242.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  243.     INLINE $701A, $AA54;
  244.     {$ENDC}
  245. FUNCTION CloseServiceWindow(window: WindowPtr): OSErr;
  246.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  247.     INLINE $7012, $AA54;
  248.     {$ENDC}
  249. FUNCTION GetFrontServiceWindow(VAR window: WindowPtr): OSErr;
  250.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  251.     INLINE $7013, $AA54;
  252.     {$ENDC}
  253. FUNCTION FindServiceWindow(thePoint: Point; VAR theWindow: WindowPtr): INTEGER;
  254.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  255.     INLINE $7017, $AA54;
  256.     {$ENDC}
  257. FUNCTION SetDefaultInputMethod(ts: Component; VAR slRecordPtr: ScriptLanguageRecord): OSErr;
  258.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  259.     INLINE $700C, $AA54;
  260.     {$ENDC}
  261. FUNCTION GetDefaultInputMethod(VAR ts: Component; VAR slRecordPtr: ScriptLanguageRecord): OSErr;
  262.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  263.     INLINE $700D, $AA54;
  264.     {$ENDC}
  265. FUNCTION SetTextServiceLanguage(VAR slRecordPtr: ScriptLanguageRecord): OSErr;
  266.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  267.     INLINE $700E, $AA54;
  268.     {$ENDC}
  269. FUNCTION GetTextServiceLanguage(VAR slRecordPtr: ScriptLanguageRecord): OSErr;
  270.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  271.     INLINE $700F, $AA54;
  272.     {$ENDC}
  273. { Component Manager Interfaces to Input Methods }
  274. FUNCTION GetScriptLanguageSupport(ts: ComponentInstance; VAR scriptHdl: ScriptLanguageSupportHandle): ComponentResult;
  275.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  276.     INLINE $2F3C, $0004, $0001, $7000, $A82A;
  277.     {$ENDC}
  278. FUNCTION InitiateTextService(ts: ComponentInstance): ComponentResult;
  279.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  280.     INLINE $2F3C, $0000, $0002, $7000, $A82A;
  281.     {$ENDC}
  282. FUNCTION TerminateTextService(ts: ComponentInstance): ComponentResult;
  283.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  284.     INLINE $2F3C, $0000, $0003, $7000, $A82A;
  285.     {$ENDC}
  286. FUNCTION ActivateTextService(ts: ComponentInstance): ComponentResult;
  287.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  288.     INLINE $2F3C, $0000, $0004, $7000, $A82A;
  289.     {$ENDC}
  290. FUNCTION DeactivateTextService(ts: ComponentInstance): ComponentResult;
  291.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  292.     INLINE $2F3C, $0000, $0005, $7000, $A82A;
  293.     {$ENDC}
  294. FUNCTION TextServiceEvent(ts: ComponentInstance; numOfEvents: INTEGER; VAR event: EventRecord): ComponentResult;
  295.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  296.     INLINE $2F3C, $0006, $0006, $7000, $A82A;
  297.     {$ENDC}
  298. FUNCTION GetTextServiceMenu(ts: ComponentInstance; VAR serviceMenu: MenuHandle): ComponentResult;
  299.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  300.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  301.     {$ENDC}
  302. FUNCTION TextServiceMenuSelect(ts: ComponentInstance; serviceMenu: MenuHandle; item: INTEGER): ComponentResult;
  303.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  304.     INLINE $2F3C, $0006, $0008, $7000, $A82A;
  305.     {$ENDC}
  306. FUNCTION FixTextService(ts: ComponentInstance): ComponentResult;
  307.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  308.     INLINE $2F3C, $0000, $0009, $7000, $A82A;
  309.     {$ENDC}
  310. FUNCTION SetTextServiceCursor(ts: ComponentInstance; mousePos: Point): ComponentResult;
  311.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  312.     INLINE $2F3C, $0004, $000A, $7000, $A82A;
  313.     {$ENDC}
  314. FUNCTION HidePaletteWindows(ts: ComponentInstance): ComponentResult;
  315.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  316.     INLINE $2F3C, $0000, $000B, $7000, $A82A;
  317.     {$ENDC}
  318. FUNCTION GetServiceList(numOfInterface: INTEGER; VAR supportedInterfaceTypes: OSType; VAR serviceInfo: TextServiceListHandle; VAR seedValue: LONGINT): OSErr;
  319.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  320.     INLINE $7008, $AA54;
  321.     {$ENDC}
  322. FUNCTION OpenTextService(idocID: TSMDocumentID; aComponent: Component; VAR aComponentInstance: ComponentInstance): OSErr;
  323.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  324.     INLINE $7009, $AA54;
  325.     {$ENDC}
  326. FUNCTION CloseTextService(idocID: TSMDocumentID; aComponentInstance: ComponentInstance): OSErr;
  327.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  328.     INLINE $700A, $AA54;
  329.     {$ENDC}
  330.  
  331. {$ALIGN RESET}
  332. {$POP}
  333.  
  334. {$SETC UsingIncludes := TextServicesIncludes}
  335.  
  336. {$ENDC} {__TEXTSERVICES__}
  337.  
  338. {$IFC NOT UsingIncludes}
  339.  END.
  340. {$ENDC}
  341.